package com.auto.code.core.enums;

/**
 * 
 * @desc 数据类型转换
 * @author meikb
 * @date 2019年9月29日	
 *
 */
public enum TypeXmlEnum {
    //------------------------------------------------------------
    MYSQL_BIGINT("bigint", "BIGINT"),
    MYSQL_BIT("bit", "INTEGER"),
    MYSQL_CHAR("char", "VARCHAR"),
    MYSQL_DECIMAL("decimal", "DECIMAL"),
    MYSQL_DOUBLE("double", "DOUBLE"),
    MYSQL_FLOAT("float", "FLOAT"),
    MYSQL_INT("int", "INTEGER"),
    MYSQL_TINYINT("tinyint", "INTEGER"),
    MYSQL_VARCHAR("varchar", "VARCHAR"),
    MYSQL_TINYTEXT("tinytext", "VARCHAR"),
    MYSQL_TEXT("text", "VARCHAR"),
	MYSQL_LONG_TEXT("longtext", "VARCHAR")

	;

    private String dbType;
    private String type;

    TypeXmlEnum(String dbType, String type) {
        this.dbType = dbType;
        this.type = type;
    }

    public static String getTypeByDb( String dbType) {
        TypeXmlEnum[] types = TypeXmlEnum.values();
        for (int i = 0; i < types.length; i++) {
            if (types[i].dbType.equalsIgnoreCase(dbType)) {
                return types[i].getType();
            }
        }
        return null;
    }

    public String getDbType() {
        return dbType;
    }

    public String getType() {
        return type;
    }
}
